<template>
	<view class="container">
		<view class="example">
			<!-- 基础用法，不包含校验规则 -->
			<uni-row class="demo-uni-row" :width="nvueWidth">
				<uni-col :span="12">
					<view class="demo-uni-col dark">姓名</view>
				</uni-col>
				<uni-col :span="12">
					<view class="demo-uni-col light">{{user.name}}</view>
				</uni-col>
			</uni-row>
			<uni-row class="demo-uni-row" :width="nvueWidth">
				<uni-col :span="12">
					<view class="demo-uni-col dark">班级</view>
				</uni-col>
				<uni-col :span="12">
					<view class="demo-uni-col light">{{classInfo.class_name}}</view>
				</uni-col>
			</uni-row>
			<uni-row class="demo-uni-row" :width="nvueWidth">
				<uni-col :span="12">
					<view class="demo-uni-col dark">考核成绩</view>
				</uni-col>
				<uni-col :span="12">
					<view class="demo-uni-col light">{{info.rank}}</view>
				</uni-col>
			</uni-row>
			<uni-row class="demo-uni-row" :width="nvueWidth">
				<uni-col :span="12">
					<view class="demo-uni-col dark">学分</view>
				</uni-col>
				<uni-col :span="12">
					<view class="demo-uni-col light">{{info.credit}}</view>
				</uni-col>
			</uni-row>
			<uni-row class="demo-uni-row" :width="nvueWidth">
				<uni-col :span="12">
					<view class="demo-uni-col dark">证书编号</view>
				</uni-col>
				<uni-col :span="12">
					<view class="demo-uni-col light">{{info.certificateCode}}</view>
				</uni-col>
			</uni-row>
			<uni-row class="demo-uni-row" :width="nvueWidth">
				<uni-col :span="12">
					<view class="demo-uni-col dark">创建时间</view>
				</uni-col>
				<uni-col :span="12">
					<view class="demo-uni-col light">{{info.createTime}}</view>
				</uni-col>
			</uni-row>

		</view>
	</view>
</template>

<script>
	import {
		getzs
	} from '@/api/jz/class/class.js';
	import {

		getStuInfo

	} from "@/api/system/user"
	import {
		getToken,
		getUser,
		getInfoId,
		getInforoleKey,
		setInfoId,
	} from '@/utils/auth';
	export default {
		data() {
			return {

				classInfo: "",
				info: "",
				user: "",
				nvueWidth: 730
			};
		},
		onLoad: function(options) {
			this.classInfo = JSON.parse(options.data)
			this.getInit();
		},
		mounted() {
			this.getInit2();
		},
		methods: {
			getInit() {
				let data = {
					studentId: "",
					classId: this.classInfo.id
				}
				getzs(data).then(res => {
					if (res.code == 200) {
						this.info = res.data
					}
				})
			},
			getInit2() {
				let id = getInfoId();
				getStuInfo(id).then(response => {
					if (response.code == 200) {
						this.user = response.data

					}

				})
			}


		}
	}
</script>

<style lang="scss">
	.demo-uni-row{
		
		margin-bottom: 50px !important;
	}
	.uni-forms-item__label {
		align-items: baseline !important;
	}

	.example {
		padding: 15px;
		background-color: #fff;
	}

	.segmented-control {
		margin-bottom: 15px;
	}

	.button-group {
		margin-top: 15px;
		display: flex;
		justify-content: space-around;
	}

	.form-item {
		display: flex;
		align-items: center;
	}

	.button {
		display: flex;
		align-items: center;
		height: 35px;
		margin-left: 10px;
	}
</style>